home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / amiexpress / source / doors / auxed / auxshell.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-26  |  1.5 KB  |  93 lines

  1. #include <exec/exec.h>
  2. #include <dos/dos.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include "work:romconf/doorheader.h"
  6.  
  7. #define AWAIT_LOGON    0
  8. #define SYSOP_LOGON    1
  9. #define LOCAL_LOGON    2
  10. #define REMOTE_LOGON    3
  11. #define GOODBYE_LOGON    4
  12. #define SUSPEND_LOGON    5
  13. int Whence_The_Logon;
  14. void EnterShell(void);
  15. int mynode;
  16. char temp[200];
  17. #define gu getuserstring
  18. #define sm sendmessage
  19. #define pm prompt
  20. void CloseAux(BPTR tfh);
  21. BPTR OpenAux(void);
  22. void end(void);
  23. void LastCommand(void);
  24. void sr(char *s);
  25. main(int argc,char *argv[])
  26. {
  27.    register int i;
  28.    if(argc!=2)
  29.    {
  30.       printf("AUXSHELL version 1.0 written by Joseph Hodge\n");
  31.       printf("\n");
  32.       exit(0);
  33.    }
  34.    Register(argv[1][0]-'0');
  35.    Whence_The_Logon=GetInfo(BB_LOGONTYPE);
  36.    mynode=argv[1][0]-'0';
  37.    EnterShell();
  38.    ShutDown();
  39.    end();
  40. }
  41. void EnterShell(void)
  42. {
  43.  BPTR fh;
  44.  
  45.  if(fh=OpenAux()) {
  46.      //sm("H",0);
  47.     Execute("execute s:REMOTE-startup",fh,0);
  48.     CloseAux(fh);
  49.  }
  50. }
  51.  
  52.  
  53. BPTR OpenAux(void)
  54. {
  55.  char str[100];
  56.  BPTR tfh;
  57.  
  58.  if(Whence_The_Logon==REMOTE_LOGON) {
  59.         sprintf(str,"AUX%u:",mynode);
  60.     } else
  61.         sprintf(str,"CNN:S*/0/1/%d/%d/LocalAux",GetInfo(BB_SCRWIDTH),GetInfo(BB_SCRHEIGHT)-1);
  62.  
  63.  if(!(tfh=Open(str,MODE_OLDFILE))) {
  64.         sm("",1);sm("The ",0);
  65.         sm(str,0);
  66.         sm(" handler can't be opened!",1);
  67.     }
  68.  return(tfh);
  69. }
  70.  
  71. void CloseAux(BPTR tfh)
  72. {
  73.  Close(tfh);
  74. }
  75.  
  76. void end(void)
  77. {
  78.   exit(0);
  79. }
  80. void LastCommand(void)
  81. {
  82.   sm("",1);
  83. }
  84. void sr(char *s)
  85. {
  86.   register int i;
  87.   i=strlen(s)-1;
  88.   while(i>-1)
  89.   {
  90.     if(*(s+i)<=32) *(s+i)='\0'; else break;
  91.     i--;
  92.   }
  93. }